'''
Title: Pupil: Eye Tracking Software
init.py
Authors: Moritz Kassner & William Patera
Date: July 12, 2011
Notes: Prototype tested with 2 XBox Live Webcams on Macbook Pro OSX 10.6.7 and Ubuntu 10.10 using OpenCV 2.2
'''

import cv
def init_screen():
	#Initiate Windows
	Eye = event(tb_global=None)
	Eye_Slider = event(tb_global=None)
	Eye_Filtered = event(tb_global=None)
	World = event(tb_global=None)
	#Initiate Sliders
	#eye sliders
	Hue_Slider = event(gv.t_hue)
	#create windows
	Eye.create_window("Eye", 0, 0)
	Eye_Filtered.create_window("Eye_Filtered", 650, 0)
	Eye_Slider.create_window("Eye_Slider", 1200, 0)
	World.create_window("World", 0, 300)
	#create sliders - eye filter
	#create_trackbar(self, tb_name, w_name, tb_min, tb_max, tb_global, tb_update

def gui_control_msg():
	print "**********************************************************\n"\
			"---PUPIL: GAZE TRACKING: (KASSNER & PATERA, 2011)---\n"\
			"---Adjust Controls to filter image\n"\
			"+++Press 'SPACE BAR' to Start/Stop Calibration Routine\n"\
			"+++Press 'd' to Show/Hide Fovea Blur Drawing - NOT WORKING\n"\
			"+++Press 'r' to Start/Stop Recording\n"\
			"+++Press 't' to Start/Stop Collecting Gaze Points in .txt file or .npy archive\n"\
			"+++Press 'esc' to quit.\n"\
			"**********************************************************\n"

def capture_init(id, width,height,fps=30):
	capture = cv.CaptureFromCAM(id)
	cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH, width)
	cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT, height)
	cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_GAIN, 0)
	cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_EXPOSURE, 0)
	return capture

